package com.hao.wms.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    public static Date getBeginDate(Date current){
        Calendar c = Calendar.getInstance();
        c.setTime(current);
        c.set(Calendar.HOUR_OF_DAY,0);
        c.set(Calendar.MINUTE,0);
        c.set(Calendar.SECOND,0);
        return c.getTime();
    }
    public static Date getEndDate(Date current){
        Calendar c = Calendar.getInstance();
        c.setTime(current);
        c.set(Calendar.HOUR_OF_DAY,0);
        c.set(Calendar.MINUTE,0);
        c.set(Calendar.SECOND,0);
        c.add(Calendar.DAY_OF_MONTH,1);
        c.add(Calendar.SECOND,-1);
        return c.getTime();
    }

    public static void main(String[] args) {
        Date d = new Date();
        System.out.println(getBeginDate(d).toLocaleString());
        System.out.println(getEndDate(d).toLocaleString());
    }
}
